﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace ERPStore.Tasks.Monitor.ViewModels
{
	public class SettingsViewModel : ViewModelBase<Models.Settings> 
	{
		public SettingsViewModel()
			: this(new Models.Settings())
		{

		}

		public SettingsViewModel(Models.Settings model)
			: base(model)
		{
			this.Address = System.Configuration.ConfigurationManager.AppSettings["address"] ?? "http://127.0.0.1/api/tasks";
			this.ApiKey = System.Configuration.ConfigurationManager.AppSettings["apikey"];
		}

		[Bindable(true)]
		public string Address
		{
			get
			{
				return base.Model.Address;
			}
			set
			{
				SetPropertyValue(() => this.Address
					, value
					, () => { Model.Address = value; });
			}
		}

		[Bindable(true)]
		public string ApiKey
		{
			get
			{
				return base.Model.ApiKey;
			}
			set
			{
				SetPropertyValue(() => this.ApiKey
					, value
					, () => { Model.ApiKey = value; });
			}
		}

	}
}
